package com.ruoyi.device.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.PrimaryKeyIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.mapper.DeviceOnOffLogMapper;
import com.ruoyi.device.api.domain.DeviceOnOffLog;
import com.ruoyi.device.service.IDeviceOnOffLogService;

/**
 * 设备上下线日志Service业务层处理
 * 
 * @author luogongquan
 * @date 2024-09-06
 */
@Service
public class DeviceOnOffLogServiceImpl implements IDeviceOnOffLogService 
{
    @Autowired
    private DeviceOnOffLogMapper deviceOnOffLogMapper;

    /**
     * 查询设备上下线日志
     * 
     * @param id 设备上下线日志主键
     * @return 设备上下线日志
     */
    @Override
    public DeviceOnOffLog selectDeviceOnOffLogById(Long id)
    {
        return deviceOnOffLogMapper.selectDeviceOnOffLogById(id);
    }

    /**
     * 查询设备上下线日志列表
     * 
     * @param deviceOnOffLog 设备上下线日志
     * @return 设备上下线日志
     */
    @Override
    public List<DeviceOnOffLog> selectDeviceOnOffLogList(DeviceOnOffLog deviceOnOffLog)
    {
        return deviceOnOffLogMapper.selectDeviceOnOffLogList(deviceOnOffLog);
    }

    /**
     * 新增设备上下线日志
     * 
     * @param deviceOnOffLog 设备上下线日志
     * @return 结果
     */
    @Override
    public int insertDeviceOnOffLog(DeviceOnOffLog deviceOnOffLog)
    {
        deviceOnOffLog.setId(PrimaryKeyIdUtils.getSysIdWorker().nextId());
        deviceOnOffLog.setCreateTime(DateUtils.getNowDate());
        return deviceOnOffLogMapper.insertDeviceOnOffLog(deviceOnOffLog);
    }

    /**
     * 修改设备上下线日志
     * 
     * @param deviceOnOffLog 设备上下线日志
     * @return 结果
     */
    @Override
    public int updateDeviceOnOffLog(DeviceOnOffLog deviceOnOffLog)
    {
        return deviceOnOffLogMapper.updateDeviceOnOffLog(deviceOnOffLog);
    }

    /**
     * 批量删除设备上下线日志
     * 
     * @param ids 需要删除的设备上下线日志主键
     * @return 结果
     */
    @Override
    public int deleteDeviceOnOffLogByIds(Long[] ids)
    {
        return deviceOnOffLogMapper.deleteDeviceOnOffLogByIds(ids);
    }

    /**
     * 删除设备上下线日志信息
     * 
     * @param id 设备上下线日志主键
     * @return 结果
     */
    @Override
    public int deleteDeviceOnOffLogById(Long id)
    {
        return deviceOnOffLogMapper.deleteDeviceOnOffLogById(id);
    }
}
